package com.project.service.impl;

import com.project.bean.UserBean;
import com.project.mapper.IUserMapper;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author lyl
 * description:用户业务实现类
 */
@Service
@Transactional
public class UserServiceImpl implements IUserService {
    @Autowired
    private IUserMapper iUserMapper;

    @Override
    public UserBean userLogin(String username, String password) {
        return iUserMapper.userLogin(username, password);
    }

    @Override
    public UserBean userRegister(UserBean userBean) {
        iUserMapper.userRegister(userBean);
        return iUserMapper.userLogin(userBean.getUsername(), userBean.getPassword());
    }

    @Override
    public boolean checkExist(String username) {
        if (iUserMapper.checkExist(username) != null) {
            return false;
        }
        return true;
    }
}
